import Vue from 'vue'
import UEasyDict from '@/uni_modules/u-easy-dict/index.js'
import dictApi from "../api/new/dict.js"
const dictList = ['product_type']
Vue.use(UEasyDict, {
	types: dictList.map(item => {
		return {
			dictKey: item,
			data(dictKey) {
				return commonFun(dictKey.dictKey)
			}
		}
	})
})

function commonFun(dictKey) {
	console.log("dictKey", dictKey)
	return new Promise((resolve) => {
		dictApi[dictKey]().then(res => {
			resolve(res.data.map(item => {
				return {
					label: item.dictLabel,
					value: item.dictValue
				}
			}))
		})
	})
}